#include <stdio.h>
#include <math.h>
long long divide(int dividend, int divisor) 
{
	if (dividend == 0)
	{
		return 0;
	}

	long long first = abs((long long)dividend);
	long long second = abs((long long)divisor);

	if (first < second)
	{
		return 0;
	}

	long long bit_sum = 1;
	int first_bit_count = 0;
	while (bit_sum <= first)
	{   //获取dividend位数
		bit_sum <<= 1;
		++first_bit_count;
	}

	long long ans = 0;
	long long remainder = 0;
	while (first_bit_count--)
	{
		bit_sum >>= 1;
		remainder <<= 1;
		remainder |= (first >> first_bit_count) & 0x01;
		if (remainder >= second)
		{
			remainder -= second;
			ans |= bit_sum;
		}
	}
	return ans;
}



int main(){
    int a,b,c,d,res=2;
    long long e;
    printf("enter 2 number:\n");
    res=scanf("%d %d",&a,&b);
    if (res!=2){printf("wrong!please enter right int number\n");}
    if (res==2){ c=a*b&65535;
    e=a*b;
    d=divide(a*b,65536);
    printf("a*b mod65537=%d\n",c-d);
    return 0;}
}
